<template>
  <div class="adduser-container">
    <el-row>
      <el-col :span="5">
        <el-card>
          <el-tree check-strictly default-expand-all :data="data" show-checkbox node-key="id" :props="defaultProps" @check-change="handleChooseNode"></el-tree>
        </el-card>
      </el-col>
      <el-col :span="18" :offset="1">
        <el-card></el-card>
      </el-col>
    </el-row>
  </div>
</template>


<script>
import {tree} from './tree'
export default {
  data() {
    return {
      data: tree,
      defaultProps: {
        children: "children",
        label: "title"
      },
      list:[],//选的数组 提交给后台
    };
  },
  methods: {
    handleChooseNode(data, checked, indeterminate){
        console.log(data, checked, indeterminate);
        if(checked){
            this.list.push(data.id)
        }
        console.log(this.list)
    }
  }
};
</script>



<style lang="scss" scoped>
.adduser-container {
  padding: 25px;
}
</style>
